from PyQt5.QtWidgets import  QTreeWidgetItem, QTreeWidget


class GTree(QTreeWidget):

    def __init__(self):
        super(GTree, self).__init__()

    def setData(self, nodes, qwd):
        for node in nodes:
            tn = QTreeWidgetItem(qwd)
            i = 0
            while i < len(node.label):
                tn.setText(i, node.label[i])
                i += 1
            if node.children:
                self.setData(node.children, tn)
